import 'dart:io';

void test() async {
  try {
    var list = Directory.current.list(recursive: false, followLinks: false);
    await for (FileSystemEntity entity in list) {
      var type = await FileSystemEntity.type(entity.path);
      String label;
      switch (type) {
        case FileSystemEntityType.file:
          label = 'F';
          break;
        case FileSystemEntityType.directory:
          label = 'D';
          break;
        case FileSystemEntityType.link:
          label = 'L';
          break;
        default:
          label = 'unKnow';
      }

      print('$label: ${entity.path}');
    }
  } catch (err) {
    if (err is FileSystemException) {
      print('FileSystemException: ${err.message}');
    } else {
      print('err: ${err.toString()}');
    }
  }
}

main() {
  test();
}
